package view.views.dialogContentViews;

import java.awt.FlowLayout;

import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import model.Constants;
import view.components.IPTextArea;
import view.listeners.IpFocusListener;

public class AddHostContent extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private final IPTextArea ipTextArea;
	private final JTextField textField;

	public AddHostContent() {

		this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

		JPanel ipLabelPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
		JPanel ipPanel = new JPanel(ipLabelPanel.getLayout());
		JPanel textLabelPanel = new JPanel(ipLabelPanel.getLayout());
		JPanel textPanel = new JPanel(ipLabelPanel.getLayout());

		JLabel ipLabel = new JLabel(Constants.ADDHOST);

		ipLabelPanel.add(ipLabel);

		ipTextArea = new IPTextArea();
		ipTextArea.getTextList().get(0)
				.addFocusListener(new IpFocusListener(ipTextArea));
		ipPanel.add(ipTextArea);

		JLabel textLabel = new JLabel(Constants.ADDHOSTNAME);

		textLabelPanel.add(textLabel);

		textField = new JTextField(15);
		textField.setBorder(null);

		textPanel.add(textField);

		this.add(ipLabelPanel);
		this.add(ipPanel);
		this.add(textLabelPanel);
		this.add(textPanel);

	}

	public IPTextArea getIpTextArea() {
		return ipTextArea;
	}

	public JTextField getNameTextField() {
		return textField;
	}

}
